#pruebas 1-6
pruebas_texto=("2Lineas.txt" "lineasYsaltos.txt" "tp1.c")
test_number=1
comparar_e_imprimir_resultado(){
    local file=$1
    shift
    local test_number=$1
    ./tp1 < $file > file1
    ./tp1 < file1 > file2
    diff -q $file file2 > /dev/null
    echo -n "prueba $test_number ($file) "
    if [ $? == 0 ] ; then
        echo	"ok"
    else	
        echo	"fallo"
        exit 1
    fi
    rm file1
    rm file2
}

for file in "${pruebas_texto[@]}"
do
    comparar_e_imprimir_resultado $file $test_number
    let test_number+=1
done

#prueba7
echo "prueba 7 (conjunto de archivos binarios):"
n=1; 
while [ $n != 10 ]; do
	head -c 10 </dev/urandom > test1;
	for (( j=0 ; j < 10; j++ ))
	do
	echo '\n' >> test1
	head -c 10 </dev/urandom >> test1;
	done
    comparar_e_imprimir_resultado test1 $n
    let n+=1
    rm test1
done; 


